{extend name="public/base" /}
{block name="title"}广告管理{/block}
{block name="css"}

{/block}
{block name="main"}

<div class="wrapper wrapper-content animated fadeInRight">
  <div class="row">
      <div class="ibox float-e-margins">
          <div class="ibox-title">
              <h5>广告管理 </h5>
              <div class="ibox-tools">
                  <a class="collapse-link">
                      <i class="fa fa-chevron-up"></i>
                  </a>
                  <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                      <i class="fa fa-wrench"></i>
                  </a>
                  <ul class="dropdown-menu dropdown-user">
                      <li><a href="{:url(request()->controller().'/addAd')}">新增广告</a></li>
                  </ul>
                  <a class="close-link">
                      <i class="fa fa-times"></i>
                  </a>
              </div>
          </div>
          <div class="ibox-content" style="padding:10px">
              <div class="row">
                  <div class="col-lg-3 col-md-3">
                      <a class="btn btn-primary" href="{:url(request()->controller().'/addAd')}">新增广告</a>
                  </div>
                  <div class="col-lg-9 col-md-9 text-right">
                      <form method="get" role="form" class="form-inline">
                          <div class="form-group">
                              <input type="text" name="title" value="{$Think.get.title|default=''}" placeholder="标题"
                                     class="form-control">
                          </div>
                          <div class="form-group">
                              <select name="slot_id" class="form-control">
                                  <option value="">广告位</option>
                                  {volist name="slotList" id="vo"}
                                  <option value="{$vo.id}" {if $vo.id==$Think.get.slot_id}selected{/if}>{$vo.title}</option>
                                  {/volist}
                              </select>
                          </div>
                          <button type="submit" class="btn btn-primary" style="margin-bottom: 0px">搜索</button>
                      </form>
                  </div>
              </div>

              <div class="table-responsive">
                  <form action="{:url(request()->controller().'/orderAd')}" class="ajax-form" method="post">
                      <table class="table table-striped table-bordered table-hover table-condensed">
                          <tr>
                              <th width="5%">排序</th>
                              <th>ID</th>
                              <th>显示位置</th>
                              <th>标题</th>
                              <th>链接</th>
                              <th>更新时间</th>
                              <th>操作</th>
                          </tr>
                          {foreach name="list" item="vo"}
                          <tr>
                              <td><input style="width:40px;height:25px;" pattern="^\d+$" type="text" name="{$vo['id']}"
                                         value="{$vo['sort']}"></td>
                              <td>{$vo.id}</td>
                              <td>{volist name="$vo.adSlots" id="adSlot"}<span class="label label-primary">{$adSlot.title}</span><br/>{/volist} </td>
                              <td>{$vo.title} {if $vo.image_id}<i class="fa fa-picture-o m-l-xs"></i>{/if}</td>
                              <td>{$vo.url}</td>
                              <td>{$vo.create_time}</td>
                              <td>
                                  <a href="{:url(request()->controller().'/editAd',['adId'=>$vo['id']])}"
                                     class="btn btn-xs btn-warning" data-toggle="tooltip" data-placement="top"
                                     title="修改"><i class="fa fa-pencil"></i> 修改</a>
                                  <button type="button" class="btn btn-xs btn-danger ajax-btn"
                                          data-action="{:url(request()->controller().'/deleteAd',['adId'=>$vo['id']])}"
                                          data-toggle="tooltip" data-placement="top" title="删除"><i
                                          class="fa fa-remove"></i> 删除
                                  </button>
                              </td>
                          </tr>
                          {/foreach}
                          <tr>
                              <th colspan="7">
                                  <button class="btn btn-success" type="submit">排序</button>
                              </th>
                          </tr>
                      </table>
                      <div id="footable-page-instead">{$pages|raw}</div>
                  </form>
              </div>
          </div>

          <!--
          <div class="ibox-title">
              <h5>图片预览</h5>
              <div class="ibox-tools">
                  <a class="collapse-link">
                      <i class="fa fa-chevron-up"></i>
                  </a>

                  <a class="close-link">
                      <i class="fa fa-times"></i>
                  </a>
              </div>
          </div>
          <div class="ibox-content">
              <div class="carousel slide" id="carousel2" style="max-width:1002px;margin:auto">
                  <ol class="carousel-indicators">
                      {volist name="list" id="vo"}
                      <li data-slide-to="{$key}" data-target="#carousel2" class='{eq name="key" value="0"}active{/eq}'></li>
                      {/volist}
                  </ol>
                  <div class="carousel-inner">
                      {volist name="list" id="vo"}
                      <div class="item {eq name="key" value="0"}active{/eq}">
                      <img alt="image" class="img-responsive" src="{$vo.image.full_file_url}">
                      <div class="carousel-caption">
                          <p>{$vo.title}</p>
                      </div>
                  </div>
                  {/volist}
              </div>
              <a data-slide="prev" href="carousel.html#carousel2" class="left carousel-control">
                  <span class="icon-prev"></span>
              </a>
              <a data-slide="next" href="carousel.html#carousel2" class="right carousel-control">
                  <span class="icon-next"></span>
              </a>
          </div>
      </div>
      -->
  </div>
  </div>
</div>


{/block}

{block name="js"}

{/block}